﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Admin_Default : System.Web.UI.Page
{
      static int iIndex = 0;
    private  DateTime ngayHientai = new DateTime();

public DateTime NgayHientai
{
  get { return ngayHientai; }
  set { ngayHientai = value; }
}

        protected void Page_Load(object sender, EventArgs e)
        {
            NgayHientai = DateTime.Now;
            HiddenField1.Value = NgayHientai.ToShortDateString();
            if(!IsPostBack)
            {
                
            }
           
        }

    
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (ckLayTatCa.Checked)
            {
                GridView1.DataSourceID = null;
                GridView1.DataSource = SqlDataSource5;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSourceID = null;
                GridView1.DataSource = SqlDataSource4;
                GridView1.DataBind();
            }
           
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
           
        }

        public void ckCheckedChanged(object sender, EventArgs e)
        {

        }
        protected void ckViPham_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox ckViPham = (CheckBox)sender;

            LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();

            TIN_RAO_VAT tinraovat = linQ.TIN_RAO_VATs.Single(tin => tin.MaTinRaoVat == int.Parse(ckViPham.ToolTip));
            tinraovat.ViPham = ckViPham.Checked;

            linQ.SubmitChanges();
        }

     protected void ckDaDuyet_CheckedChanged(object sender, EventArgs e)
     {
         CheckBox ckDaDuyet = (CheckBox)sender;

         LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();

         TIN_RAO_VAT tinraovat = linQ.TIN_RAO_VATs.Single(tin => tin.MaTinRaoVat == int.Parse(ckDaDuyet.ToolTip));
         tinraovat.DaDuyet = ckDaDuyet.Checked;

         linQ.SubmitChanges();
     }
     protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
     {
         CheckBox ckDeleted = (CheckBox)sender;

         LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();

         TIN_RAO_VAT tinraovat = linQ.TIN_RAO_VATs.Single(tin => tin.MaTinRaoVat == int.Parse(ckDeleted.ToolTip));
         tinraovat.Deleted = ckDeleted.Checked;

         linQ.SubmitChanges();
     }
}
